package wetalk.software.bupt.com.wetalk.application;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;

import cn.bmob.im.BmobNotifyManager;

/**
 * Created by hp on 2018/1/15.
 */

public class WeTalkNotifyManager {
    public static NotificationManager mNotificationManager;
    public static final int NOTIFY_ID = 0;
    Context globalContext;
    private static volatile BmobNotifyManager INSTANCE;
    private static Object INSTANCE_LOCK = new Object();

    public WeTalkNotifyManager() {
    }

    public static BmobNotifyManager getInstance(Context context) {
        if(INSTANCE == null) {
            Object var1 = INSTANCE_LOCK;
            synchronized(INSTANCE_LOCK) {
                if(INSTANCE == null) {
                    INSTANCE = new BmobNotifyManager();
                }

                INSTANCE.init(context);
            }
        }

        return INSTANCE;
    }

    public void init(Context context) {
        this.globalContext = context;
        mNotificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
    }

    public void cancelNotify() {
        if(mNotificationManager != null) {
            mNotificationManager.cancel(0);
        }

    }

    public void cancelAll() {
        if(mNotificationManager != null) {
            mNotificationManager.cancelAll();
        }

    }
}
